<?php if (!isset($v_sval)) exit; ?>
<?php
$v_offset = (isset($_REQUEST["hdn_offset"])) ? $_REQUEST["hdn_offset"] : 0;
$v_num_row = (isset($_REQUEST["hdn_num_row"])) ? $_REQUEST["hdn_num_row"] : SYS_ITEMS_PER_PAGE;

$edit_event_id = (isset($_REQUEST["hdn_event_id"])) ? $_REQUEST["hdn_event_id"] : 0;

$event_title = '';
$event_date = '';
$event_time = '';
$event_detail = '';

if ( $edit_event_id ){
	if ( $user_id == getOwnerEvent($edit_event_id) ){
		$rs = getSingerEvent($edit_event_id);
		
		if ( $arr = mysql_fetch_assoc($rs)){
			$event_id = $arr['EVENT_ID'];
			$event_title = $arr['EVENT_TITLE'];
			$event_date = convertSQLDatetoDate($arr['EVENT_DATE']);
			$event_time = $arr['EVENT_TIME'];
			$event_detail = $arr['EVENT_DETAIL'];
		}
	}
	else{
		redir('?a=ACC&acc=USER&user=EVEN');
	}
}

$v_where_clause = " AND ACCOUNT_ID = '".$user_id."'";
$rs_all_event = getAllEvent($v_where_clause,$v_offset ,$v_num_row);
$v_dsp_event_list = '';
    $v_inc = 1;
while ( $arr_event = mysql_fetch_array($rs_all_event,MYSQL_NUM)){
	$v_event_id=$arr_event["0"];
	$v_event_title=$arr_event["1"];
	$v_event_date=$arr_event["2"];
	$v_event_time=$arr_event["3"];
	$v_event_detail=$arr_event["4"];
	$v_account_id=$arr_event["5"];
	
	$v_dsp_event_list .='
	<div class="event_content">
		<div class="event_title">
			<span class="title">'.$v_event_title.'</span>
			<i>( ' .$v_event_time . '
			' . _LB_DAY . ' ' . date('d/m/Y',strtotime($v_event_date)) . ' )</i>
			<a href="?a=ACC&acc=USER&user=EVEN&hdn_event_id='.$v_event_id.'">
						'._IMAGE_EDIT_IMAGE.'</a>
			<a onclick=\'if(!confirm("Chac chan chua")){return false;}\' href="?a=ACC&acc=USER&user=EVEN&even=D&hdn_event_id='.$v_event_id.'">
						'._IMAGE_DELETE_IMAGE.'</a>
		</div>
		<div class="event_detail">
			' . $v_event_detail . '
		</div>
    </div>';	
    $v_inc++;

}		
$v_number_of_all_result = countAll($v_where_clause,'TB_EVENT');
?>
